def wrong(s):
	l = s.split(' ')
	if int(l[0])>int(l[1]):
		d = int(l[0]) - int(l[1])
	else:
		d = int(l[1]) - int(l[0])
	for i in range(6,10):
		if i != d%10:
			print (d/10)*10 +i		
			break
		
		else:
			pass

wrong(raw_input())
